package com.xposed.aliproxy.pollinglooper.poll;

/**
 * 外部开启轮询调用接口
 * Created by Su on 2019/1/4.
 */
public class PollingUtil {
    /**
     * 开始轮询服务
     *
     * @param period 轮询间隔
     */
    public static void startPollingService(String action, PollListener listener, long period) {
        PollingScheduler.getInstance().addScheduleTask(action, 0, period, listener);
    }

    /**
     * 停止轮询服务
     */
    public static void stopPollingServices(String action) {
        PollingScheduler.getInstance().clearScheduleTasks(action);
    }

    /**
     * 停止所有轮询服务
     */
    public static void stopAllPollingServices() {
        PollingScheduler.getInstance().clearScheduleTasks();
    }
}
